package com.hk.employeemanagementsystem.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author by 何坤
 * @Classname MyWebCorsConfig
 * @Description TODO
 * @Date 2019/12/5 15:42
 */
@Configuration
public class MyWebCorsConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedHeaders("*")
                .allowCredentials(true)
                .maxAge(3600)
                .allowedOrigins("*")
                .allowedMethods("GET", "POST", "DELETE", "PUT");
    }
}
